<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'/>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<link href="css/base.css" rel="stylesheet" type="text/css" media="screen" />
<link href="css/swiper3.07.min.css" rel="stylesheet" type="text/css" media="screen" />
<script src="js/jquery-1.11.0.min.js" type="text/javascript" ></script>
<script src="js/swiper3.07.jquery.min.js" type="text/javascript" ></script>
<script src="js/common.js" type="text/javascript" ></script>

<title>小展Story</title>

</head>
<body>

<div id="orientLayer" class="mod-orient-layer">
	   <div class="mod-orient-layer__content">
	       <i class="icon mod-orient-layer__icon-orient"></i>
	       <div class="mod-orient-layer__desc">为了更好的体验，请使用竖屏浏览</div>
	   </div>
</div>


<div class="banner">
<div class="swiper-container">
    <div class="swiper-wrapper" id="swiper-wrapper">
    </div>
    <div class="pagination"></div>
</div>
</div>

<div class="item">
<ul>
<li id="item1"><a href="index.html?lx=0" >小展新闻</a></li>
<li id="item4"><a href="index.html?lx=3" >创新科技</a></li>
<li id="item2"><a href="index.html?lx=1" >媒体说</a></li>
<li id="item3"><a href="index.html?lx=2" >精彩活动</a></li>
</ul>
</div>

<div class="lists">
<ul id="lists"></ul>
</div>

<div>
	<span id="noSapn" style="display: none;">没有更多内容了</span>
	<a href="#" onclick="more();" id="more">加载更过</a>
</div>

<script>

	var banners=[];
	var limitFrom=0;
	var lx=getQueryString("lx");
	if(lx==""||lx==undefined||lx==null){
		lx=0;
	}
	
	if(lx=="0"){
		$("#item1").find("a").addClass('active');
	}else if(lx=="1"){
		$("#item1").find("a").addClass('active');
	}else if(lx=="2"){
		$("#item3").find("a").addClass('active');
	}else if(lx=="3"){
		$("#item4").find("a").addClass('active');
	}
	
	
	function more(){
		getData(5,limitFrom);
	}
	
	function createLis(objs){
		var lis="";
		for(var i in objs){
			var href="news_show.html?id="+objs[i].id;
			if(objs[i].href2!=null&&objs[i].href2!='null'&&objs[i].href2!=undefined){
				href=objs[i].href2;
			}
			lis+="<li>";
			lis+="<a href=\""+href+"\"><span><img src=\""+basePath+"/file?id="+objs[i].blogo+"\"></span>";
			lis+="<strong>"+objs[i].title+"";
			lis+="<span>时间："+objs[i].publishTimeStr+"</span></strong></a>";
			lis+="</li>";
		}
		return lis;
		
	}
	
	
	
	function getData(pageSize,limitFromP){
		$.ajax({
   		 type:'get',
   		 url:basePath+'/getIndexInfo',
   		 data:'pageSize='+pageSize+"&limitFrom="+limitFromP+"&lx="+lx,
   		 success:function(data){
   			 
   			limitFrom+=pageSize;
   			 
   			 data=data.data;
   			 banners=data.banners;
   			 var zx=data.zx;
   			 
   			 if(limitFrom==0){
   				 var bannersHtml="";
   	   			 for(var i in banners){
   	   				 var href="#";
   	   				 if(banners[i].url!=""&&banners[i].url!=undefined&&banners!='null'){
   	   					 href=banners[i].url;
   	   				 }
   	   				 bannersHtml+="<div class=\"swiper-slide\"><a href=\""+href+"\"><div><span>"+banners[i].desp+"</span></div><img src=\""+basePath+"/file?id="+banners[i].id+"\"/></a></div>";
   	   			 } 
   	   			 
   	   			$("#swiper-wrapper").html(bannersHtml);
  			 	var mySwiper = new Swiper('.swiper-container',{
  					calculateHeight:true,
  					resizeReInit:true,
  					pagination:".pagination",
  					autoplay:5000,
  					paginationClickable:true,
  					loop: true,
  					autoplayDisableOnInteraction:false
  				});		
   			 }
   			 
   			 if(zx.length==0){
   				 $("#noSapn").show();
   				 $("#more").hide();
   			 }else{
   				 $("#lists").append(createLis(zx));
   			 }
   			 
   		 }
   	 });
	}
	
    $(document).ready(function() {
    	 getData(10,0);
	 });
</script>

</body>
</html>